<!doctype html>
<html xmlns:th="http://www.thymeleaf.org"
	xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">
<head th:replace="portal/common/header :: header"></head>
<body style="padding-top: 60px;">

	<link th:href="@{/resources/css/cdn.bootstrap.css}" rel="stylesheet">
	<link th:href="@{/resources/css/cdn.site.css}" rel="stylesheet">
	<link th:href="@{/resources/css/learn.style.css}" rel="stylesheet">

	<!-- nav_start-->
	<div th:replace="portal/common/nav :: nav"></div>
	<!-- nav_end-->
	
	<style type="text/css">
		.codelist a.item-top .item-icons i {
			font-size: 20px;
		}
		.codelist a.item-top {
			padding: 5px !important;
			margin: 10px 6px;
		}
		.codelist {
			margin-bottom: 10px;
		}
		.function-settings {
			float: right;
			font-size: 14px;
			cursor:pointer;
			color: #FF9900;
			margin-right: 15px;
		}
	</style>
	
	<!--  内容  -->
	<header class="site-header" style="background-color: #395ce9; padding-top: 60px;">
		<div class="container jumbotron">
			<div class="row">
				<div class="col-xs-12">
					<p>
						个人所用平台模块和常用功能列表<br>
						<span class="package-amount">共收录了 <strong>3434</strong>
							个功能
						</span>
					</p>
				</div>
			</div>
		</div>
	</header>
	
	<div class="container main">
	
	<div class="row">
			<div  id="learingItemsList" class="col middle-column-home" style="width: 100%; max-width: 1200px;">
			
				<!-- 最后使用_start -->
				<div class="codelist codelist-desktop cate1">
					<h2>
						<i class="fa fa-list"></i> <span>最近使用</span>
					</h2>
					<a th:href="${item.modulePath}" th:each="item,stat:${os}" th:target="${item.openTarget}" class="item-top item-1">
						<div class="item-icons">
							<i th:class="${item.moduleLogo}"></i>
						</div>
						<div class="item-desc">
							<h4>
								<span th:text="${item.moduleName}"></span>
							</h4>
						</div>
					</a> 
				</div>
				<!-- 我的模块_end -->

			</div>
		</div>
		<br/>
		
		<div class="row">
			<div  id="learingItemsList" class="col middle-column-home" style="width: 100%; max-width: 1200px;">
			
				<!-- 我的模块_start -->
				<div class="codelist codelist-desktop cate1">
					<h2>
						<i class="fa fa-list"></i> <span>我的模块</span>
						<span onclick="moduleItem()" class="function-settings"><i class="fas fa-code"></i> 配置</span>
					</h2>
					<a th:href="${item.modulePath}" onclick="recordSelect(1,this)" th:data-id="${item.id}" th:each="item,stat:${ms}" th:target="${item.openTarget}" class="item-top item-1">
						<div class="item-icons">
							<i th:class="${item.moduleLogo}"></i>
						</div>
						<div class="item-desc">
							<h4>
								<span th:text="${item.moduleName}"></span>
							</h4>
						</div>
					</a> 
				</div>
				<!-- 我的模块_end -->
				
				<!-- 我的功能_start -->
				<div class="codelist codelist-desktop cate1">
					<h2>
						<i class="fas fa-leaf"></i> 
						<span>我的功能</span>
						<span onclick="linkItem()" class="function-settings"><i class="fas fa-code"></i> 配置</span>
					</h2>
					<a th:href="${item.functionPath}" onclick="recordSelect(0,this)" th:data-id="${item.id}"  th:each="item,stat:${fs}" th:target="${item.openTarget}" class="item-top item-1">
						<div class="item-icons">
							<i th:class="${item.functionLogo}"></i>
						</div>
						<div class="item-desc">
							<h4>
								<span th:text="${item.functionName}"></span>
							</h4>
						</div>
					</a> 
				</div>
				<!-- 我的功能_end -->
				
			</div>
		</div>
	</div>

	<section class="ddc-discount ddc-block" id="discount">
		<div class="ddc-discount__inner container" style="max-width:1200px;">
			<h3 class="ddc-block__title">文档与工具</h3>
			<div class="ddc-discount__content">
				<a class="OMEGA_DDC_PC_W_DC2_ACTIVITY_ENT_CK" onclick="window.open(location.origin + '/activity.html#buyAuth')">
					<div class="ddc-discount__item">
						<h4 class="ddc-discount__item-title">开发教程文档</h4>
						<p class="ddc-discount__item-subtitle">助力企业0成本上云</p>
						<div class="ddc-discount__item-arrow"></div>
					</div>
				</a>
				<a class="OMEGA_DDC_PC_W_DC2_ACTIVITY_PER_CK" onclick="window.open(location.origin + '/activity.html#buyAuth')">
					<div class="ddc-discount__item">
						<h4 class="ddc-discount__item-title">过程使用工具</h4>
						<p class="ddc-discount__item-subtitle">爆款仅售9.9元</p>
						<div class="ddc-discount__item-arrow"></div>
					</div>
				</a>
			</div>
		</div>
	</section>

	<!-- footer start -->
	<div th:replace="portal/common/footer:: footer"></div>
	<!-- footer start -->
	
	<script th:src="@{/asserts/vendors/layer/layer.js}"></script>	
	<script type="text/javascript">

		// 常用功能
		function recordSelect(_type , _self){
			$.post(ctx+"portal/desktop/web/module/click", {id: $(_self).data("id") , type:_type}, function(response) {
				console.log('response = ' + response);
			})
		}
	
		// 授权 
		function moduleItem() {
			layer.open({
				type : 2,
				title : '模块功能',
				shadeClose : true,
				shade : 0.8,
				area : [ '500px', '700px' ],
				maxmin : true, //开启最大化最小化按钮
				content : ctx+ 'pages/portal/views/ucenter/module', 
				btn: ['确认', '取消'] , 
				yes: function(index, layero){
					console.log("index = " + index + " layero = " + layero) ; 
					var selectResourceParentNode = $(layero).find("iframe")[0].contentWindow.document.getElementById("selectResourceParentNode")
					var rolesId = $(selectResourceParentNode).attr("data-id") ; 	
					console.log("rolesId = " + rolesId ) ; 
					
					$.post(ctx+"portal/desktop/web/module/authAccount", {rolesId: rolesId}, function(response) {
						console.log('response = ' + response);
						if(response.code != 200){
							layer.alert(response.message) ; 
						} else {
							layer.msg("操作成功.")	
						}
					})
					layer.close(index) ; 
				 }
			});
		}
		
		function linkItem(path) {
			layer.open({
				type : 2,
				title : '链接功能',
				shadeClose : true,
				shade : 0.8,
				area : [ '500px', '700px' ],
				maxmin : true, //开启最大化最小化按钮
				content : ctx+ 'pages/portal/views/ucenter/function', 
				btn: ['确认', '取消'] , 
				yes: function(index, layero){
					console.log("index = " + index + " layero = " + layero) ; 
					var selectResourceParentNode = $(layero).find("iframe")[0].contentWindow.document.getElementById("selectResourceParentNode")
					var rolesId = $(selectResourceParentNode).attr("data-id") ; 	
					console.log("rolesId = " + rolesId ) ; 
				
					var loading = layer.load(1, {
						  shade: [0.8,'#000'] //0.1透明度的白色背景
					});
					
					$.post(ctx+"portal/desktop/web/linkPath/authAccount", {rolesId: rolesId}, function(response) {
						console.log('response = ' + response);
						if(response.code != 200){
							layer.alert(response.message) ; 
						} else {
							layer.msg("操作成功.")	
						}
						layer.close(loading) ; 
					})
					
					layer.close(index) ; 
				 }
			});
			
		}
	</script>

</body>
</html>
